//
//  YoucApiTask.h
//  YoucApi
//
//  Created by Liam on 12-11-3.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ApiTaskBase.h"

#define TASK_AUTO_REGISTER(TYPE) \
	id ret##TYPE = [ApiTaskFactory regClientTask:TYPE taskClass:[YA##TYPE class]];

#define SAFE_STRING(p) \
({ \
    id ret = p; \
    if (ret == [NSNull null]) \
    { \
        ret = @""; \
    } \
    ret; \
})

typedef enum {
	TaskNone = -1,
	TaskGameGetGameList,
	TaskSearchGames,
    TaskGameGetGameServerList,
    TaskGameGetRecommendList,
    TaskUserRegister,
	TaskUserLogin,
	TaskUserKeepSession,
	TaskUserGetInfo,
	TaskUserUpdateInfo,
	TaskUserGetAttention,
	TaskUserAddAttention,
	TaskUserDeleteAttention,
	TaskPutDeviceToken,
	TaskSetDND,
	TaskCheckVersion
} TaskType;

@interface YoucApiTask : ApiTaskBase {

}

- (NSString *)_getKeys;
- (NSString *)_getMessage;
- (id)_getRequest;
- (NSString *)_getUriParamC;
- (NSString *)_getUriParamA;
- (BOOL)_checkValidResponse:(id)responseObject;
- (NSInteger)apiErrorCodeFromErrorCode:(NSInteger)code;

- (void)_dealWithJSONResponse:(id)responseObject withError:(NSError *)error;

@end
